<?php
namespace Admin\Controller;
use Think\Controller;
class TypesController extends Controller {
	
	//分类首页
    public function index(){
    	$model = M('classes');
    	
    	$this->total = $model->count();
    	$this->data = $model->field(" * ,concat(path,id) pp")->order("pp asc")->select();
//  	echo $model->getLastSql();
    	$this->display();
    }
    
    //添加页
    public function add(){
    	$this->display();
    }
    
    //添加操作
    public function insert(){
    	if(IS_POST){
    		//实例化数据模型
    		$model = M('classes');

    		if($model->add($_POST)){
    			$this->success('添加成功',U("index"));
    		}else{
    			$this->error('添加失败',U("add"));
    		}
    	}
    }
}